<?php
$DH = dir("./templates/");
$options = "";
while ($styleDir = $DH->read()) {
	if (preg_match('/^..?$/', $styleDir)) continue;
   	
	// Check for style.xml
	if(!is_dir("./templates/".$styleDir)) continue;
	if(file_exists("./templates/".$styleDir."/style.xml")) {
		$xml = simplexml_load_file("./templates/".$styleDir."/style.xml");
		// Selected?
		if($styleDir == General::getInstance()->getGlobalVar("tplFolder")) $selected = 'selected="selected"';
		else $selected = "";
		
		$options .= "<option value='".$styleDir."' ".$selected.">".$xml->name."</option>";
	}
}
$DH->close();

$linksData['linkName'] = "Styleswitcher";
$linksData['linkHTML'] = "<form method='get' action='' name='style'>
	<select name='styleSwitcher'>".$options."</select>
	<input type='submit' name='s' value='Wechseln' /></form>";
$links[$linksData['linkCatId']][] = $linksData;
?>